package com.uyii.springbootsensitive.utils;

public class SensitiveDataHandler {
    public static String mask(String data, String type) {
        return switch (type) {
            case "PHONE" -> data.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
            case "EMAIL" -> data.replaceAll("(.{2}).+(.{2}@.+)", "$1****$2");
            default -> data;
        };
    }
}